﻿// ***********************************************************************
// Assembly         : ElFinder.Net
// Author           : Lolo
// Created          : 06-05-2013
//
// Last Modified By : Lolo
// Last Modified On : 06-05-2013
// ***********************************************************************
// <copyright file="Options.cs" company="">
//     Copyright (c) . All rights reserved.
// </copyright>
// <summary></summary>
// ***********************************************************************
using System.Runtime.Serialization;
using System.Collections.Generic;

namespace ElFinder.Response
{
    /// <summary>
    /// Class Archive
    /// </summary>
    [DataContract]
    internal class Archive
    {
        /// <summary>
        /// The _empty
        /// </summary>
        private static string[] _empty = new string[0];
        /// <summary>
        /// Gets the create.
        /// </summary>
        /// <value>The create.</value>
        [DataMember(Name = "create")]
        public IEnumerable<string> Create { get { return _empty; } }

        /// <summary>
        /// Gets the extract.
        /// </summary>
        /// <value>The extract.</value>
        [DataMember(Name = "extract")]
        public IEnumerable<string> Extract { get { return _empty; } }
    }
    /// <summary>
    /// Class Options
    /// </summary>
    [DataContract]
    internal class Options
    {
        /// <summary>
        /// The _empty
        /// </summary>
        private static string[] _empty = new string[0];
        /// <summary>
        /// The _disabled
        /// </summary>
        private static string[] _disabled = new string[] { "extract", "create" };
        /// <summary>
        /// The _empty archives
        /// </summary>
        private static Archive _emptyArchives = new Archive();

        /// <summary>
        /// Gets the is copy overwrite.
        /// </summary>
        /// <value>The is copy overwrite.</value>
        [DataMember(Name = "copyOverwrite")]
        public byte IsCopyOverwrite { get { return 1; } }

        /// <summary>
        /// Gets the separator.
        /// </summary>
        /// <value>The separator.</value>
        [DataMember(Name = "separator")]
        public string Separator { get { return "/"; } }

        /// <summary>
        /// Gets or sets the path.
        /// </summary>
        /// <value>The path.</value>
        [DataMember(Name = "path")]
        public string Path { get; set; }

        /// <summary>
        /// Gets or sets the thumbnails URL.
        /// </summary>
        /// <value>The thumbnails URL.</value>
        [DataMember(Name = "tmbUrl")]
        public string ThumbnailsUrl { get; set; }

        /// <summary>
        /// Gets or sets the URL.
        /// </summary>
        /// <value>The URL.</value>
        [DataMember(Name = "url")]
        public string Url { get; set; }

        /// <summary>
        /// Gets the archivers.
        /// </summary>
        /// <value>The archivers.</value>
        [DataMember(Name = "archivers")]
        public Archive Archivers { get { return _emptyArchives; } }

        /// <summary>
        /// Gets the disabled.
        /// </summary>
        /// <value>The disabled.</value>
        [DataMember(Name = "disabled")]
        public IEnumerable<string> Disabled { get { return _disabled; } }

        /// <summary>
        /// Initializes a new instance of the <see cref="Options" /> class.
        /// </summary>
        /// <param name="fullPath">The full path.</param>
        public Options(FullPath fullPath)
        {
           
            Path = fullPath.RelativePath;
            Url = fullPath.Root.Url;
            ThumbnailsUrl = fullPath.Root.TmbUrl;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Options" /> class.
        /// </summary>
        public Options() { }
    }
}